package com.gitee.loocao.boot.enjoy.autoconfigure;

import org.springframework.boot.autoconfigure.template.PathBasedTemplateAvailabilityProvider;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class EnjoyTemplateAvailabilityProvider extends PathBasedTemplateAvailabilityProvider {

    public EnjoyTemplateAvailabilityProvider() {
        super("com.jfinal.template.Engine", EnjoyTemplateAvailabilityProperties.class, "jfinal.enjoy");
    }

    static final class EnjoyTemplateAvailabilityProperties
            extends TemplateAvailabilityProperties {

        private List<String> templateLoaderPath = new ArrayList<>(Arrays.asList(EnjoyProperties.DEFAULT_TEMPLATE_LOADER_PATH));

        EnjoyTemplateAvailabilityProperties() {
            super(EnjoyProperties.DEFAULT_PREFIX, EnjoyProperties.DEFAULT_SUFFIX);
        }

        @Override
        protected List<String> getLoaderPath() {
            return this.templateLoaderPath;
        }

        public List<String> getTemplateLoaderPath() {
            return this.templateLoaderPath;
        }

        public void setTemplateLoaderPath(List<String> templateLoaderPath) {
            this.templateLoaderPath = templateLoaderPath;
        }

    }
}
